const mixins = require("../mixins");
var app = getApp()
Page({
  behaviors: [mixins],
  /**
   * 页面的初始数据
   */
  data: {
    active: "",
    listData: [],
    activity_list: [],
    page: 1,
    last_page: 1,
    activity_id: "", //活动id
    stage_status: "", //活动状态id
    grand_love_pay: 0,
    grand_point_pay: 0,
    grand_love_returned: 0,
    grand_point_returned: 0,
    grand_love_surplus: 0,
    grand_point_surplus: 0,
    point_name: '',
    love_name:''
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function () {
    this.getdata()
  },
  detail(e){
    let id = e.currentTarget.dataset.id;
    wx.navigateTo({
      url: '/packageF/subscribe/detail/detail?id='+id,
    })
    console.log(e);
  },
  activeInfo({
    detail
  }) {
    let stage_list = detail.data.stage_list.data || [],
      activity_id = detail.activity_id,
      stage_status = detail.stage_status;

    this.setData({
      page: detail.data.stage_list.current_page,
      last_page: detail.data.stage_list.last_page,
      active: detail.active,
      listData: stage_list,
      activity_id,
      stage_status
    })
  },
  getdata() {
    app._postNetWork({
      url: app.getNetAddresss("plugin.subscription.frontend.modules.member.controllers.activity.index"),
      success: res => {
        if (res.data.result) {
          let {
            grand_love_pay,
            grand_point_pay,
            grand_love_returned,
            grand_point_returned,
            grand_love_surplus,
            grand_point_surplus,
            love_name,
            point_name
          } = res.data.data
          this.setData({
            activity_list: res.data.data.activity_list,
            grand_love_pay,
            grand_point_pay,
            grand_love_returned,
            grand_point_returned,
            grand_love_surplus,
            grand_point_surplus,
            love_name,
            point_name
          })
        } else {
          app.tips(res.data.msg)
        }
      }
    })
  },
  getMoreData() {},
  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {

  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function () {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function () {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function () {

  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function () {

  }
})